<template>
  <div
    v-cloak
    id="app"
    :style="'--mb7color:' + mb7Color"
    style="max-width:16rem;margin:0 auto;height:100%;"
    class="c-fc-xblack coms-app-container"
    :class="[showNav && enableNavTabbar && isFaShou==0 ? 'c-pt68' : '', careModel == 1 ? 'care-model' : '']"
  >
    <!-- 内页顶部bar showNavTabbar是用来判断是否开启这个展示，showNav则说页面切换是否展示，避免重复渲染 -->
    <navtabbar v-if="enableNavTabbar && isFaShou==0" v-show="showNav" :companyAuth="companyAuth"></navtabbar>
    <my-loading :showLoading="isLoading"></my-loading>
    <skeleton v-show="isSkeleton"></skeleton>
    <keep-alive>
      <router-view
        class="router-view"
        :style="
          (isShowhref == true &&
            companyAuth != null &&
            companyAuth.enableShowInfo == 1) ||
            isCloumnDistribution ||
            isliveAnnual
            ? 'min-height:' +
              (height -
                (hasBottomFixedBtn
                  ? (clientWidth * 80) / 320
                  : (clientWidth * 52) / 320) -
                (showNav == true ? (clientWidth * 34) / 320 : 0)) +
              'px;'
            : 'min-height:' +
              (height -
                (hasBottomFixedBtn ? (clientWidth * 40) / 320 : 0) -
                (showNav == true ? (clientWidth * 34) / 320 : 0)) +
              'px;'
        "
        v-if="$route.meta.keepAlive && (companyAuth != null || isNotWechat)"
      ></router-view>
    </keep-alive>
    <router-view
      v-if="!$route.meta.keepAlive && (companyAuth != null || isNotWechat)"
      :style="
        (isShowhref == true &&
          companyAuth != null &&
          companyAuth.enableShowInfo == 1) ||
          isCloumnDistribution ||
          isliveAnnual
          ? 'min-height:' +
            (height -
              (hasBottomFixedBtn
                ? (clientWidth * 80) / 320
                : (clientWidth * 52) / 320) -
              (showNav == true ? (clientWidth * 34) / 320 : 0)) +
            'px;'
          : 'min-height:' +
            (height -
              (hasBottomFixedBtn ? (clientWidth * 40) / 320 : 0) -
              (showNav == true ? (clientWidth * 34) / 320 : 0)) +
            'px;'
      "
    >
    </router-view>
    <bottom-company-info v-if="companyAuth" :showInfo="(isShowhref && companyAuth.enableShowInfo == 1) || isCloumnDistribution || isliveAnnual" :showDefaultText="isliveAnnual || isCloumnDistribution" :hasBottomFixedBtn="hasBottomFixedBtn" :isMicropage="isMicropage" :extraPaddingBottom="extraPaddingBottom"></bottom-company-info>
    <template v-if="isVisitor != 1 && companyAuth"> <!--游客模式下不展示弹窗-->
      <ios-virtual-pay :showVitualModal="showVitualModal"></ios-virtual-pay>
      <!-- 店铺引导 -->
      <guide-com v-if="showGuide"></guide-com>
      <attention-qr-code></attention-qr-code>
      <go-top v-if="isShowGoTop"></go-top>
      <to-miniprogram></to-miniprogram>
      <!-- 开屏优惠券 -->
      <coupon-modal
        v-if="showNewUserCoupon"
        :adName="couponName"
        :adCoupon="adCoupon"
        :osId="recordType"
        :recordType="recordType"
        :showCouponDialog.sync="showNewUserCoupon"
      ></coupon-modal>
      <add-area-modal v-show="!$route.fullPath.includes('/homePage/login/pcLogin') && $route.path != '/clearLocalStorage'" ref="aam" @closeAddArea="closeAddArea" :showAddAreaModal="showAddAreaModal" :isNeed="locateType == 1" @ignoreArea="closeAddArea"></add-area-modal>
      <recommend-present ref="recommendPresent"></recommend-present>
      <!-- 侧边悬浮窗 -->
      <suspension-Group-Com :suspensionGroupSet="suspensionGroupSet"></suspension-Group-Com>
      <back-to-live></back-to-live>
      <complaint></complaint>
      <SystemError />
      <QuickBindMobile v-if="!$route.fullPath.includes('/homePage/agent/protocolInfo') && !$route.fullPath.includes('/homePage/login/') && $route.path != '/clearLocalStorage'" :locateType="locateType" :notAllowClose="isRetrieve || enableBindPhoneInRegister == 1 || ($isStore() && !storeConfig.isStoreVisit)" :isRetrieve="isRetrieve" @finishBindMobile="finishBindMobile" />
      <MergeRetrieveCount />
      <MergeUser />
    </template>
    <cj-popup v-if="!$route.fullPath.includes('/homePage/login/pcLogin') && !$route.fullPath.includes('/homePage/agent/protocolInfo') && !$route.fullPath.includes('/homePage/login/') && $route.path != '/clearLocalStorage'" v-model="isShowStorePerssionPopup" :close-on-click-overlay="false" round zIndex="120000" title="提示" class="c-w70"><div class="c-ph30 c-fs26 c-fc-sblack c-pb30">您的账号暂无访问权限，请先联系管理员在后台用户列表中给您的账号授权后,再登录</div></cj-popup>
  </div>
</template>

<script>
import bottomCompanyInfo from "@/components/templates/common/bottomCompanyInfo.vue";
import guideCom from "@/components/templates/common/guideCom.vue";
import iosVirtualPay from "@/components/templates/common/pay/iosVirtualPay.vue";
import attentionQrCode from "@/components/templates/common/attentionQrCode.vue";
import Navtabbar from "@/components/templates/common/navTabbar.vue";
import Skeleton from "@/components/templates/common/skeleton.vue";
import myLoading from "@/plugin/loading/loading.vue";
import couponModal from "@/components/templates/couponModal.vue";
import addAreaModal from "@/components/templates/addAreaModal.vue";
import backToLive from "@/components/templates/live/backToLive.vue";
import complaint from "@/components/templates/common/complaint.vue";
import recommendPresent from '@/components/templates/recommendPresent.vue'
import SystemError from '@/components/templates/common/systemError.vue'
import QuickBindMobile from '@/components/templates/common/bindMobileComponent/quickBindMobile.vue'
import MergeRetrieveCount from '@/components/templates/common/bindMobileComponent/mergeRetrieveCount.vue'
import MergeUser from '@/components/templates/common/bindMobileComponent/mergeUser.vue'
import { mapState } from "vuex";
import { utilJs } from "@/utils/common.js";
import GoTop from "./components/templates/common/goTop.vue";
import ToMiniprogram from "./components/templates/common/toMiniprogram.vue";
import suspensionGroupCom from "@/components/templates/custIndexTemp/suspensionGroupCom.vue";
import { reportPageViewByRouter, reportPageViewTime, initAppVisibilityChangeEvent } from "@/utils/userTraceLog.js";
let touchTimeCon = null;
var startTimeTmp = 0; //记录刚进入页面时间戳
var pageDeep = 0; //记录页面深度
let enterRouterTimeTmp = 0;
export default {
  components: {
    myLoading,
    navtabbar: Navtabbar,
    iosVirtualPay,
    bottomCompanyInfo,
    guideCom,
    attentionQrCode,
    Skeleton,
    GoTop,
    couponModal,
    backToLive,
    complaint,
    addAreaModal,
    ToMiniprogram,
    recommendPresent,
    SystemError,
    QuickBindMobile,
    MergeRetrieveCount,
    MergeUser,
    suspensionGroupCom
  },
  created() {
    if (localStorage.getItem("microPageScroll")) {
      localStorage.removeItem("microPageScroll"); //微页面返回上一级回到上次滑动的位置，每次刷新页面，从头加载
    }
    let it = localStorage.getItem("companyId") + "|token";
    if (localStorage.getItem("token") && localStorage.getItem(it)) {
      // 微信需要判断是否是小程序环境
      if (utilJs.checkWxApp()) {
        utilJs.getWxAppNav(); // 获取小程序底部导航栏
      }
      this.getCompanyShare();
    }
    startTimeTmp = new Date().getTime();
    if (utilJs.isWeiXin()) {
      utilJs.wechatConfig("", "", "", "", function() {}, false, {
        firstConfig: 1,
        isWxOpenAudio: 1,
        isWxOpenLaunchWeap: 1
      }); //首次进入要去取一下jsconfig，防止已进入就用到微信的内容
    }
    // 如果存在表单缓存，需要判断表单是否超过5天，超过5天就自动清除掉缓存数据
    if (localStorage.getItem("formDraft")) {
      let formDraft = localStorage.getItem("formDraft") || '';
      formDraft = formDraft ? JSON.parse(formDraft) : {}
      let setDraftTime = Number(formDraft.setDraftTime || 0)
      if (startTimeTmp - setDraftTime > (5 * 24 * 60 * 60 * 1000)) {
        localStorage.removeItem("formDraft")
      }
    }
  },
  mounted() {
    if (utilJs.isIOSAppALL()) {
      window.removeEventListener("touchstart", this.longTouchStart);
      window.removeEventListener("touchmove", this.longTouchMove);
      window.removeEventListener("touchend", this.longTouchEnd);
      window.addEventListener("touchstart", this.longTouchStart);
      window.addEventListener("touchmove", this.longTouchMove);
      window.addEventListener("touchend", this.longTouchEnd);
    }
    window.removeEventListener("unload", this.pageUnLoad, false);
    window.addEventListener("unload", this.pageUnLoad, false);
    initAppVisibilityChangeEvent();
    if (localStorage.getItem("goldPlanBackUrl")) {
      setTimeout(() => {
        localStorage.removeItem("goldPlanBackUrl");
      }, 1500);
    }
    this.postMD(); //发送埋点
    setTimeout(() => {
      if (localStorage.getItem("token") != null && localStorage.getItem(localStorage.getItem("companyId") + "|token")) {
        utilJs.getGiftCardInfo(1); // 获取充值卡信息，主要是为了刷新页面可以重新请求接口，刷新充值卡信息
      }
    }, 1000)
    // 直播套iframe打开项目的时候，直接再html上加 data-open-by='liveiframe'，openByModule：标识某个模块或者区域
    if (this.liveGlobalData.openFromBy == 1) {
      document.documentElement.setAttribute('data-open-by', this.liveGlobalData.openFromBy);
      if (this.liveGlobalData.openByModule) {
        document.documentElement.setAttribute('data-open-by-module', this.liveGlobalData.openByModule);
      }
    }
  },
  data() {
    return {
      mb7Color: localStorage.getItem("mb7ThemeColor") || "#ff8831",
      clientWidth:
        window.innerWidth ||
        document.documentElement.clientWidth ||
        document.body.clientWidth,
      height:
        window.innerHeight ||
        document.documentElement.clientHeight ||
        document.body.clientHeight,
      companyAuth: null,
      isNotWechat: false,
      showNav: false,
      hasBottomFixedBtn: true,
      isShowhref: false,
      isCloumnDistribution: false,
      isliveAnnual: false,
      showNewUserCoupon: false,
      adCoupon: [],
      couponName: "",
      opId: "",
      recordType: "",
      isShowGoTop: false,
      showAddAreaModal: false,
      enableBindPhoneInRegister: 0,
      isVisitor: localStorage.getItem("isVisitor") || 0, //1是游客
      isRetrieve: false, // 是否需要走账号平移流程
      locateType: false,
      enableNavTabbar: 1, // 是否开启顶部导航 默认开启
      isFaShou: 0,
      careModel: 0,
      extraPaddingBottom: false, //需要额外底部垫高高度
      suspensionGroupSet: null, // 悬浮窗组件设置
      isShowStorePerssionPopup: false, // 是否显示门店的权限提示框
      storeConfig:{}, // 门店配置
    };
  },
  watch: {
    $route(to, from) {
      //判断confirm弹窗是否开启，有开启的时候，调整页面要把弹窗自动关闭掉
      if (Vue.prototype.$cjConfirm && Vue.prototype.$cjConfirm.checkIsShow && Vue.prototype.$cjConfirm.checkIsShow()) {
        Vue.prototype.$cjConfirm.hide();
      }
      reportPageViewByRouter(to, from);
      reportPageViewTime(to, from);
      this.isVisitor = localStorage.getItem("isVisitor") || 0;
      if (this.showVitualModal) {
        this.$store.commit("updateShowVitualModal", false);
      }
      if (this.showGuide) {
        this.$store.commit("updateShowGuide", false);
      }
      this.$store.commit('updateShowComplaint', false);
      this.reportRouterChange(to, from);
      pageDeep++;
      //隐藏一下页面的顶部导航
      let isiOS = utilJs.isIOSAppALL();
      let isAnApp = utilJs.isAndroidApp();
      if (isiOS && (to.path == "/homePage/live/liveRoom" || to.path == "/homePage/socialGroup/chatRoom" || to.path == "/homePage/privateClass/privateLiveRoom")) {
        window.removeEventListener("contextmenu", this.onContextmenu);
        window.addEventListener("contextmenu", this.onContextmenu);
      }
      //ww67ok 私人订制
      let isCustomMadeCompanyId = ["gw39", "jzqpv7"];
      if (isiOS || isAnApp || to.meta.unShowNav || isCustomMadeCompanyId.includes(localStorage.getItem("companyId")) ||
        (to.path == "/homePage/login/bindMobile" &&
          (to.fullPath.includes("retrieve") ||
            localStorage.getItem("companyId") == "ww67ok")) ||
        (to.path == "/homePage/login/bindMobile" && to.fullPath.includes("isLogin")) ||
        to.path.includes("/homePage/login/wechatAuth") || localStorage.getItem('isWxApp')
      ) {
        this.showNav = false;
      } else {
        this.showNav = true;
      }
      this.isNotWechat = false;
      //防止跳到自带浏览器的时候资料下载页面因为不存在companyAuth而导致页面不渲染
      if (
        (to.path.includes("datumDownload") || to.path.includes('homePage/course/aliPayMiddlePage') ||
          to.path.includes("homePage/login/qrLogin")) && !utilJs.isWeiXin()
      ) {
        this.isNotWechat = true;
      }
      //ios,安卓这几个页面要放行
      if (
        to.path.includes("iosBindMobile") ||
        to.path.includes("protocolInfo") ||
        to.path.includes("clearLocalStorage") ||
        to.path.includes("shopAuthResult") ||
        (to.path == "/homePage/login/bindMobile" && to.fullPath.includes("isLogin")) ||
        to.path.includes("homePage/login/wechatAuthPage") ||
        (to.path == "/" || to.path == "")
      ) {
        this.isNotWechat = true;
      }
      if (!to.path.includes("datumDownload") && !to.path.includes('homePage/course/aliPayMiddlePage') && !localStorage.getItem("companyAuth") && localStorage.getItem("token")) {
        this.getCompanyShare();
      }

      let navbottombar = false;
      let navarr = localStorage.getItem("companyAuth") ? JSON.parse(localStorage.getItem("companyAuth")).companyNav : [];
      for (let i = 0; i < navarr.length; i++) {
        navbottombar =
          navbottombar ||
          (to.path == "/message/messageIndex" && navarr[i].navType == 3) ||
          (to.path == "/mall/mallIndex" && navarr[i].navType == 1) ||
          (to.path == "/activity/activityIndex" && navarr[i].navType == 2) ||
          (to.path == "/homePage/clockIn/clockInList" &&
            navarr[i].navType == 6) ||
          (to.path == "/homePage/column/columnList" &&
            navarr[i].navType == 7) ||
          (to.path == "/homePage/examination/examinationList" &&
            navarr[i].navType == 8) ||
          (to.path == "/homePage/socialGroup/socialGroupList" &&
            navarr[i].navType == 9) ||
          (to.path == "/homePage/collage/collageList" &&
            navarr[i].navType == 10) ||
          (to.path == "/homePage/qa/answerLord" && navarr[i].navType == 12) ||
          (to.path == "/homePage/live/liveList" && navarr[i].navType == 5) ||
          (to.path == "/homePage/reservation/reservationList" &&
            navarr[i].navType == 13) ||
          (to.path == "/homePage/word/wordList" && navarr[i].navType == 14);
      }
      if (
        navbottombar ||
        to.meta.hasBottomFixedBtn ||
        to.fullPath == '/edu/faceTeaching?faceType=3'
      ) {
        this.hasBottomFixedBtn = true;
      } else {
        this.hasBottomFixedBtn = false;
      }
      // 一键置顶
      this.isShowGoTop = to.meta.isShowGoTop;
      if (
        to.meta.unShowhref ||
        to.path.includes("/homePage/giftCode") ||
        to.path.includes("/homePage/about/companyInfoSubmit") ||
        (to.path == "/homePage/login/bindMobile" && to.query.isLogin)
      ) {
        this.isShowhref = false;
      } else {
        this.isShowhref = true;
      }
      if (
        (to.query.distribution == 1 || to.query.distributionId) &&
        (to.path == "/homePage/column/columnDetail" ||
          to.path == "/homePage/course/video" ||
          to.path == "/homePage/course/voice" ||
          to.path == "/homePage/course/imgText")
      ) {
        this.isCloumnDistribution = true;
      } else {
        this.isCloumnDistribution = false;
      }
      let liveAnnual = localStorage.getItem("companyAuth")
        ? JSON.parse(localStorage.getItem("companyAuth")).liveAnnual
        : 0;
      if (liveAnnual == 1 && (to.path == "/homePage/privateClass/classDetail" || to.path == "/homePage/privateClass/classLiveList")) {
        this.isliveAnnual = true;
      } else {
        this.isliveAnnual = false;
      }

      if (to.meta.isSkeleton) {
        //详情页显示骨架屏
        this.$store.commit("updateSkeletonStatus", {
          isSkeleton: true
        });
        if (localStorage.getItem("uMobile") == "" || localStorage.getItem("uMobile") == null) {
          this.getCoupon(); //新用户进商品详情页优惠券弹窗
        }
      } else {
        this.$store.commit("updateSkeletonStatus", {
          isSkeleton: false
        });
      }

      //IOS页面一直是首页问题处理
      if (!from.name) {
        let u = window.location.href.split("/");
        let su = u[0] + "/" + u[1] + "/" + u[2] + "/" + u[3] + "/" + u[4] + "/" + "?#" + from.fullPath;
        localStorage.setItem("firstPage", su);
      }
      //个人中心和首页引导
      if (to.path == "/" || to.path == "/member/memberIndex") {
        this.initGuide();
      }
      if (to.path == "/homePage/microPage/microPage" || to.path == "/homePage/preview/previewIndex") {
        this.isMicropage = true;
      } else {
        this.isMicropage = false;
      }
      // 表单增加了高度额外处理
      if (to.path == "/homePage/form" || to.path == "/homePage/course/coursePay" || to.path == "/activity/myTicket") {
        this.extraPaddingBottom = to.path == "/homePage/course/coursePay" ? 'c-pb232' : 'c-pb180';
      } else {
        this.extraPaddingBottom = '';
      }
      // 侧边悬浮窗
      this.suspensionGroupSet = null;
      const suspensionTypeMap = {
        '/homePage/microPage/microPage': '1',
        '/': '3',
        '/member/memberIndex': '4',
        '/homePage/course/video': '5',
        '/homePage/course/voice': '5',
        '/homePage/course/imgText': '5',
        '/homePage/column/columnDetail': '6',
        '/homePage/camp/campDetail': '7',
        '/homePage/package/packageDetail': '8',
        '/homePage/live/liveDetail': '9',
        '/mall/shopDetail/shopDetail': '10',
        '/homePage/clockIn/clockInDetail': '11',
        '/activity/activityDetail': '12'
      }
      // 预约约课 || 分销专栏 不展示悬浮组件
      if (to.path in suspensionTypeMap && !((to.path == '/activity/activityDetail' && to.query.from == 'reservation') || (to.path == '/homePage/column/columnDetail' && to.query.distribution))) {
        this.suspensionGroupSet = {
          type: suspensionTypeMap[to.path]
        }
        // 微页面需要传微页面id
        if (to.query && to.query.mId) this.suspensionGroupSet.mId = to.query.mId;
      }
    },
  },
  computed: {
    ...mapState({
      route: (state) => state.route,
      path: (state) => state.route.path,
      deviceready: (state) => state.app.deviceready,
      showVitualModal: (state) => state.oem_store.showVitualModal,
      showGuide: (state) => state.oem_store.showGuide,
      isLoading: (state) => state.oem_store.isLoading,
      isSkeleton: (state) => state.oem_store.isSkeleton,
      showBindPhoneModal: (state) => state.oem_store.showBindPhoneModal,
      liveGlobalData:(state) => state.live.globalData, //直播的全局数据
    }),
  },
  methods: {
    //获取公司信息以及配置
    getCompanyShare() {
      let getUrl = `company/share?timestamp=${Date.now()}`;
      let queryPath = '';
      //有这个值代表需要绑定关系，需要传给后端
      const reservedRefereeId = localStorage.getItem("reservedRefereeId");
      if (reservedRefereeId) {
        queryPath = `${queryPath}&reservedRefereeId=${reservedRefereeId}`;
      }
      const protectRefereeId = sessionStorage.getItem("protectRefereeId");
      if (protectRefereeId) {
         queryPath = `${queryPath}&protectRefereeId=${protectRefereeId}`
      }
      utilJs.getMethod(`${global.apiurl}${getUrl}${queryPath}`, res => {
        //平台已关闭
        if (res.status == 302) {
          this.$routerGo(this, "replace", {
            path: "/error/closePage?msg=" + res.msg,
          })
        }
        //黑名单
        if (res.isInBlackList == 1) {
          this.$routerGo(this, "replace", {
            path: `/error/blacklistError`,
          })
        }
        //格鲁旦更 商家 ID:1011904;-- 私人订制
        let personalGldg = localStorage.getItem("companyId") == "ww67ok";
        //平移商家 && 没有注册过 && 手机号为空 && 不是小程序  =》弹出绑定手机号
        if (((res.status == 2 && !res.registerBeforeShift) || personalGldg) && !res.userMobile && !this.$isWxApp()) {
          this.isRetrieve = true;
          this.$store.commit("updateShowBindPhoneModal", { showBindPhoneModal: true });
          //81 => //悟空全球道场 376；, 加料云学 1024：智汇云讲堂，companyId=17 (17 => 4edn)  n9v8==>卡神 9j8z==》周子学堂; 1333 => mraz, 1091 => 7vmd, 679 => k6q5; 826 => qg66 道星散人
          if (
            this.$route.query.recRelateId &&
            this.$route.query.recType == 2 &&
            this.$route.path == "/"
          ) {
            localStorage.setItem("bindPhone", 1);
          }
        } else {
          this.isRetrieve = false;
        }
        // 中泰定制
        let setpersonal = ['79jee7', '8rxm', '5r4y7'];
        if (setpersonal.includes(localStorage.getItem('companyId'))) {
          document.documentElement.setAttribute('data-platform-theme', 'zhyt');
        }
        // 394 => ldwk百家青少年 iosApp定制
        if (utilJs.isIOSAppALL() && localStorage.getItem("companyId") == "ldwk" && !res.userMobile) {
          this.$routerGo(this, "push", {
            path: "/homePage/login/bindMobile",
            query: { isGoHome: 1 },
          });
        }
        //其他公共缓存
        localStorage.setItem("hideHead", res.hideHead);
        localStorage.setItem("shareTitle", res.shareTitle);
        localStorage.setItem("shareDesc", res.shareDesc);
        localStorage.setItem("shareLogo", res.logo);
        localStorage.setItem("mpName", res.mpName);
        localStorage.setItem("uMobile", res.userMobile || '');
        localStorage.setItem("categoryLevel", res.categoryLevel);
        localStorage.setItem("hasWxapp", res.enableWxapp); //是否有小程序
        localStorage.setItem("showForm", res.enableFormModule); //是否展示表单模块
        localStorage.setItem("questionCustom", res.questionCustom); //定制阿卡西线上学院
        localStorage.setItem("voteCustomName", res.voteCustomName); //投票自定义文案
        localStorage.setItem("rmb2Points", res.rmb2Points); // 积分换算比例
        localStorage.setItem("enableAlipay", res.enableAlipay || 0); // 是否开启了支付宝支付
        localStorage.setItem("useLvYueApp", res.lYData ? res.lYData.useLvYueApp : 0); // 是否开启履约app
        localStorage.setItem("enableGuideSet", res.lYData ? res.lYData.enableGuideSet : -1); // 是否开启履约app
        localStorage.setItem("domain", res.domain); // PC端域名
        localStorage.setItem(`gzqr${localStorage.getItem("companyId")}`, res.mpQrcode);
        localStorage.setItem("profitModel", res.profitModel);
        localStorage.setItem("mId", res.mId || ''); // 设置为微页面的id
        if (this.$isWxApp()) {
          // 如果是套壳小程序，微页面id取得另一个值
          localStorage.setItem("mId", res.amId || '');
        }
        localStorage.setItem("enableBindPhoneInRedeemCode", res.enableBindPhoneInRedeemCode); // 绑定手机号优化后，之前的控制开关弃用（除了领取优惠券）
        localStorage.setItem("enableBindPhoneInHead", res.enableBindPhoneInHead); //顶部推广是否需要绑定手机号
        localStorage.setItem("categoryLevel", res.categoryLevel); // 课程模板分类，样式
        localStorage.setItem("categoryTheme", res.categoryTheme); // 课程模板分类，样式
        localStorage.setItem("isFillUserInfo", res.isFillUserInfo);
        localStorage.setItem("enableAreaAgent", res.enableAreaAgent);
        localStorage.setItem("enableXhAreaAgent", res.enableXhAreaAgent);
        localStorage.setItem("pointsOnBuyingAudio", res.pointsOnBuyingAudio);
        localStorage.setItem("pointsOnBuyingVideo", res.pointsOnBuyingVideo);
        localStorage.setItem("enableNewEditor", res.enableNewEditor);
        localStorage.setItem("locateType", res.locateType);
        localStorage.setItem("enableStudyFirst", res.enableStudyFirst);
        localStorage.setItem("enableChainModel", res.enableChainModel);
        localStorage.setItem("userName", res.nickname || '');
        localStorage.setItem("realName", res.realName || '');
        localStorage.setItem("userHeadImg", res.headimgurl || '');
        localStorage.setItem("companyName", res.companyName);
        localStorage.setItem("customUserInfo", res.customUserInfo || "[]");
        localStorage.setItem("enableWriteAddress", res.enableWriteAddress || ""); // 绑定手机时是否必填所在地
        localStorage.setItem("cfg", JSON.stringify(res.cfg));
        localStorage.setItem("enableEbookWatermark", res.cfg.enableEbookWatermark || '');
        localStorage.setItem("enableExamWatermark", res.cfg.enableExamWatermark || '');
        localStorage.setItem("ebookWatemarkConfig", JSON.stringify(res.cfg.ebookWatemarkConfig)); // 电子书水印
        localStorage.setItem("examWatermarkConfig", JSON.stringify(res.cfg.examWatermarkConfig)); // 测评水印
        localStorage.setItem("enableFictitious", res.cfg.enableFictitious); //虚拟数 1开启 0 关闭
        localStorage.setItem("enableTeamAward", res.enableTeamAward || '');
        localStorage.setItem("useOrderV24", res.useOrderV24); //订单灰度版本区分

        //缓存userid
        const curUserId = res.userId == -100 ? '' : res.userId;
        localStorage.setItem("userId", curUserId);
        //缓存ios支付关开
        let iosGzhPayConfs = res.iosGzhPayConfs ? JSON.stringify(res.iosGzhPayConfs) : '';
        localStorage.setItem("iosGzhPayConfs", iosGzhPayConfs);
        // 微信关怀模式
        this.careModel = res.careModel || 0;
        if (!this.careModel) { // 关怀模式关闭的情况下，页面引入禁止放大字体
          this.wechatFontsize();
        }
        localStorage.setItem("careModel", this.careModel); // 个人关怀模式用于个人中心关怀模式是否开启
         //判断当前用户是不是股东
         const isShareholder = res.isShareholder;
         const storageShareholderId = localStorage.getItem("shareholderId");
        if (isShareholder) {
          if (!storageShareholderId || storageShareholderId != curUserId) {
            window.localStorage.setItem("shareholderId", curUserId);
          }
        } else if (storageShareholderId && storageShareholderId == curUserId) {
            window.localStorage.removeItem("shareholderId");
        }
        // aes加密信息
        let aesKey = res.passKey && res.passKey.key;
        let aesVi = res.passKey && res.passKey.vi;
        localStorage.setItem("aesKey", aesKey);
        localStorage.setItem("aesVi", aesVi);
        // 区域代理
        this.locateType = res.locateType;
        localStorage.setItem("locateType", res.locateType);

        //vip信息缓存
        let vipInfo = res.vipInfo || [];
        let vipArr = vipInfo.filter(i => i.vipType == 2);
        let svipArr = vipInfo.filter(i => i.vipType == 4);
        if (vipArr.length) {
          let vipArr1 = {
              cmpId: vipArr[0].cmpId,
              price: vipArr[0].price,
            };
          localStorage.setItem("vipArr1", JSON.stringify(vipArr1));
        } else {
           localStorage.removeItem("vipArr1");
        }
        if (svipArr.length > 0) {
          let svipArr1 = {
            cmpId: svipArr[0].cmpId,
            price: svipArr[0].price,
          };
          localStorage.setItem("svipArr1", JSON.stringify(svipArr1));
        } else {
          localStorage.removeItem("svipArr1");
        }
        const userVipType = res.userVipType;
        this.$store.commit("updateUserVipType", userVipType);
        localStorage.setItem(`vipType${curUserId}`, userVipType);

        //积分名称自定义
        let customPointName = res.customPointName || '积分';
        localStorage.setItem("customPointName", customPointName);


        //服务商相关
        res.customName.agentName = res.customName.agentName || "代理商";
        res.customName.partnerName = res.customName.partnerName || "合伙人";
        res.customName.branchName = res.customName.branchName || "分公司";
        res.customName.cooName = res.customName.cooName || "运营中心";
        res.customName.agencyName = res.customName.agencyName || "总代";
        res.customName.serviceProviderName = res.customName.serviceProviderName || "服务商";
        localStorage.setItem("customName", JSON.stringify(res.customName));


        //主题颜色相关
        this.mb7Color = res.color;
        let rgbColor = utilJs.hexToRgb(res.color);
        let rgbGradient = `linear-gradient(90deg,rgba(${rgbColor},1) 0%,rgba(${rgbColor},0.5) 100%);`;
        let rgbGradient180 = `linear-gradient(180deg,rgba(${rgbColor},1) 0%,rgba(${rgbColor},0.5) 100%);`;
        let rgbGradient18002 = `linear-gradient(180deg,rgba(${rgbColor},0.20) 0%,rgba(${rgbColor},0.06) 100%);`;
        let rgbGradient18020 = `linear-gradient(180deg,rgba(${rgbColor},0.20) 0%,rgba(${rgbColor},0.00) 100%);`;
        let rgbGradient18000 = `linear-gradient(180deg,rgba(${rgbColor},1) 0%,rgba(${rgbColor},0) 100%);`;
        let rgbGradient18050 = `linear-gradient(180deg,rgba(${rgbColor},0.5) 0%,rgba(${rgbColor},0) 100%);`;
        let shadowcolor = `0px 3px 10px 0px rgba(${rgbColor}, 0.2);`; // 模板色box-shadow
        let rgba6color = `rgba(${rgbColor},0.06)`;
        let rgba10color = `rgba(${rgbColor},0.1)`;
        let rgba20color = `rgba(${rgbColor},0.2)`;
        let rgba50color = `rgba(${rgbColor},0.5)`;
        let rgba80color = `rgba(${rgbColor},0.8)`;
        let marketColor = global.marketThemeBg[res.marketColorName || 'mk_red'];
        let marketColorRgb0 = utilJs.hexToRgb(marketColor[0]);
        let rgba10MarketColor = `rgba(${utilJs.hexToRgb(marketColor[0])},0.1)`;
        let rgba50MarketColor = `rgba(${utilJs.hexToRgb(marketColor[0])},0.5)`;
        document.querySelector("body").style.cssText = document.querySelector("body").style.cssText + `--mb7color:${this.mb7Color};--rgbcolor:${rgbGradient};--rgbcolor2:${rgbGradient180};--rgbcolor3:${rgbGradient18002};--rgbcolor4:${rgbGradient18000}; --rgbcolor5: ${rgbGradient18020};--rgbacolor18050:${rgbGradient18050};--rgba6color:${rgba6color};--rgba10color:${rgba10color};--rgba80color:${rgba80color};--rgba20color:${rgba20color};--rgba50color:${rgba50color};--shadowcolor:${shadowcolor}--marketColor1:${marketColor[0]};--marketColor2:${marketColor[1]};--rgba10MarketColor:${rgba10MarketColor};--rgba50MarketColor:${rgba50MarketColor};--marketColorRgb:${marketColorRgb0}`;
        localStorage.setItem("mb7ThemeColor", res.color);
        localStorage.setItem("themeName", res.themeName);
        localStorage.setItem("colorName", res.colorName);
        localStorage.setItem("marketColorName", res.marketColorName || 'mk_red');
        //客服信息相关
        if (res.customerConf) {
          localStorage.setItem("customerConf", JSON.stringify(res.customerConf));
        }
        if (res.customerConfMp) {
          localStorage.setItem("customerConfMp", JSON.stringify(res.customerConfMp));
        }

        //问答信息相关
        if (res.questionInfo) {
          localStorage.setItem("questionInfo", JSON.stringify(res.questionInfo));
        }

        //versionType--版本类型【1初级版，2分类版，3平台版，4渠道版，5五级代理, 6 OMO版本（平台版+股东分红）,8.新平台版，9.新OMO版，10.新区域版, 11.多区域版， 12.发售版】
        //发售相关
        this.isFaShou = res.versionType == 12 ? 1 : 0;
        localStorage.setItem("isFaShou", this.isFaShou)

        // companyAuth相关
        //顶部tabbar
        this.enableNavTabbar = res.companyAuth && res.companyAuth.companyTopNav && res.companyAuth.companyTopNav.style && res.companyAuth.companyTopNav.style == 5 ? 0 : 1;
        this.$store.commit('updateShowNavBar', this.enableNavTabbar)
         //IOSAPP关闭积分抵扣
        if (utilJs.isIOSAppALL()) {
          res.companyAuth.enablePoints = 0;
        }
        res.companyAuth.integrateName1 = customPointName;
        res.companyAuth.integrateName2 = customPointName;
        res.companyAuth.companyNav = this.getCompanyNav(res.companyAuth.companyNav);
        localStorage.setItem("companyAuth", JSON.stringify(res.companyAuth));
        const appConfig = {
          companyName: res.companyName,
          logo: res.logo
        };
        this.$store.commit("updateAppConfig", appConfig);
        this.companyAuth = res.companyAuth;
        //注册绑定手机号相关 enableBindPhoneInRegister:0不填 1必填  2选 isLiveTeacherBindMobile==1直播讲师绑定手机号
        if ((res.enableBindPhoneInRegister == 1 || res.enableBindPhoneInRegister == 2 || this.$route.query.isLiveTeacherBindMobile == 1) && !res.userMobile && curUserId && !this.$isWxApp()) {
          this.$store.commit("updateShowBindPhoneModal", {showBindPhoneModal: true});
          this.enableBindPhoneInRegister = Number(res.enableBindPhoneInRegister);
        } else if (
          //没填写地址 && 非游客 && 是区域代理
          !(res.provinceId || res.cityId || res.areaId) && curUserId && (res.locateType == 1 || res.locateType == 2) &&
          !(((res.status == 2 && !res.registerBeforeShift) || personalGldg) && !res.userMobile) //非平移，因为平移会弹出绑定手机号，不需要再弹这个框
        ) {
          this.showAddAreaModal = true;
          this.$nextTick(() => {
            this.$refs.aam.getAreaListForAgent();
          })
        }
        this.handleStorePerssion();
      })
    },
    // 处理门店权限
    handleStorePerssion() {
      if (utilJs.getStoreId()) {
        // 是门店，请求门店的权限接口
        utilJs.getStorePermission().then((storeConfig) => {
          this.storeConfig = storeConfig;
          let userMobile = localStorage.getItem("uMobile");
          if (!storeConfig.isStoreVisit) {
            if (!userMobile) {
              // 没权限没有手机号码的时候，弹起手机号码
              this.$store.commit("updateShowBindPhoneModal", { showBindPhoneModal: true });
            } else {
              this.isShowStorePerssionPopup = true;
              this.$store.commit("updateShowBindPhoneModal", { showBindPhoneModal: false });
            }
          }
        });
      }
    },
    getCompanyNav(companyNav) {
      if (!companyNav || (companyNav && companyNav.length == 0)) return
      if (localStorage.getItem('isWxApp') && localStorage.getItem('wxAppNav')) {
        companyNav = JSON.parse(localStorage.getItem('wxAppNav'))
      }
      for (let k = 0; k < companyNav.length; k++) {
        if (companyNav[k].navType == 22) {
          let queryObj = utilJs.getQueryObject(
            companyNav[k].otherHref
          );
          if (queryObj["mId"]) {
            companyNav[k].mId = queryObj["mId"];
          }
          if (queryObj["isPromotedAccount"]) {
            companyNav[k].isPromotedAccount = queryObj["isPromotedAccount"];
          } else {
            companyNav[k].isPromotedAccount = 0;
          }
        }
      }
      return companyNav
    },
    // 微信字体是否允许放大
    wechatFontsize() {
      let ua = window.navigator.userAgent.toLowerCase();
      if (ua.match(/MicroMessenger/i) == 'micromessenger') {
        if (utilJs.isAdnroidBrower()) {
          // 安卓
          if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
            this.handleFontSize();
          } else {
            if (document.addEventListener) {
              document.addEventListener("WeixinJSBridgeReady", this.handleFontSize, false);
            } else if (document.attachEvent) {
              document.attachEvent("WeixinJSBridgeReady", this.handleFontSize);
              document.attachEvent("onWeixinJSBridgeReady", this.handleFontSize);
            }
          }
        } else {
          /* IOS禁止微信内置浏览器调整字体大小 */
          document.querySelector("html").style.cssText = document.querySelector("html").style.cssText + ' -ms-text-size-adjust: 100% !important;-webkit-text-size-adjust: 100% !important;text-size-adjust: 100% !important;-moz-text-size-adjust: 100% !important;';
          document.querySelector("body").className = "fontAdjust";
        }
      }
    },
    handleFontSize() {
      // 设置网页字体为默认大小
      WeixinJSBridge.invoke('setFontSizeCallback', {
        'fontSize': 0
      });
      // 重写设置网页字体大小的事件
      WeixinJSBridge.on('menu:setfont', function () {
        WeixinJSBridge.invoke('setFontSizeCallback', {
          'fontSize': 0
        });
      });
    },
    /**
     * 监听路由变化上报服务器做数据埋点
     */
    reportRouterChange(to, from) {
      let scrollTop =
        document.documentElement && document.documentElement.scrollTop
          ? document.documentElement.scrollTop
          : document.body.scrollTop;
      let stayTime =
        enterRouterTimeTmp == 0 ? 0 : Date.now() - enterRouterTimeTmp;
      enterRouterTimeTmp = Date.now();
      let data = {
        from: from.fullPath, //来源页面地址
        fromScrollTop: scrollTop, //进入当前页面前来源页的滚动高度
        to: to.fullPath, //当前页面地址
        stayTime: stayTime, //在上个页面待的时长(单位ms)
      };
      window.ckjrReportData(data);
    },
    initGuide() {
      let companyAuth =
        localStorage.getItem("companyAuth") &&
        JSON.parse(localStorage.getItem("companyAuth"));
      if (!companyAuth) {
        setTimeout(() => {
          this.initGuide();
        }, 2000);
        return;
      }
      let enableGuide = companyAuth.enableGuide;
      if (
        enableGuide == 0 ||
        navigator.userAgent.toLowerCase().indexOf("micromessenger") == -1
      ) {
        return;
      }
      let showGuide = companyAuth.showGuide; //引导显示次数
      let localShowGuide = localStorage.getItem("localShowGuide") || 0;
      if (localShowGuide * 1 < showGuide) {
        localShowGuide = localShowGuide * 1 + 1;
        localStorage.setItem("localShowGuide", localShowGuide);
        this.$store.commit("updateShowGuide", true);
      }
    },
    //发送埋点
    postMD() {
      if (localStorage.getItem("token") && localStorage.getItem("sourceForm")) {
        let datas = {
          sourceForm: localStorage.getItem("sourceForm"),
        };
        utilJs.postMethod(
          `${global.apiurl}common/sourceArgsHandle`,
          datas,
          (res) => {
            localStorage.removeItem("sourceForm");
          }
        );
      }
    },
    //长按事件开始
    longTouchStart(e) {
      clearTimeout(touchTimeCon);
      touchTimeCon = setTimeout(() => {
        this.longClickEvent(e);
      }, 250);
    },
    //长按事件移动
    longTouchMove() {
      clearTimeout(touchTimeCon);
      touchTimeCon = null;
    },
    //长按事件结束
    longTouchEnd() {
      clearTimeout(touchTimeCon);
      touchTimeCon = null;
    },
    longClickEvent(e) {
      if (
        e.target.nodeName.toLowerCase() == "img" &&
        e.target.className.indexOf("app-save-img") > -1
      ) {
        let iosData = {
          type: "1",
          src: e.target.src,
        };
        window.webkit.messageHandlers.iosWechatImgLongTouch.postMessage(
          JSON.stringify(iosData)
        );
        // eslint-disable-next-line no-undef
        iosWechatImgLongTouch.postMessage(
          JSON.stringify(iosData)
        );
      }
    },
    // 获取新用户优惠券
    getCoupon() {
      utilJs.getMethod(`${global.apiurl}common/newUserOP`, (res) => {
        this.couponName = res.name;
        this.adCoupon = res.arrRedeemCode;
        this.recordType = res.recordType;
        this.opId = res.opId * 1;
        let couponDialogList = localStorage.getItem(`showCouponDialog`);
        couponDialogList =
          (couponDialogList && JSON.parse(couponDialogList)) || [];
        if (couponDialogList.includes(this.opId)) {
          this.showNewUserCoupon = false;
          return;
        }
        //不为推荐有礼时弹优惠券弹窗
        if (
          this.adCoupon != null &&
          this.adCoupon.length > 0 &&
          this.adCoupon != "[]" &&
          (!this.$route.query.recRelateId || !this.$route.query.recType)
        ) {
          this.showNewUserCoupon = true;
          this.adCoupon.forEach((item) => {
            if (item.validStatus != 1 && item.validStatus != 2) {
              //领取后开始计算有效期和领取次日开始计算有效期的，startAt和endAt为null
              item.startAt = item.startAt.substr(0, 10).replace(/-/g, ".");
              item.endAt = item.endAt.substr(0, 10).replace(/-/g, ".");
            }
          });
        }
      });
    },
    //监听页面关闭前，发送埋点数据 stayTime 停留时长 pageDeep 访问深度
    pageUnLoad() {
      let stayTime = new Date().getTime() - startTimeTmp;
      let postUrl = `${global.apiurl}common/visitStat`;
      let postData = new FormData();
      let isAnd = navigator.userAgent.indexOf("APPLogin") > -1; //andrio手机
      let isiOS =
        navigator.userAgent.indexOf("IOSLogin") > -1 ||
        navigator.userAgent.indexOf("IOSNewLogin") > -1 ||
        navigator.userAgent.indexOf("IOSNewApp") > -1; //IOS手机
      let fromApp = isAnd ? " android" : isiOS ? "ios" : "oa";
      postData.append("fromApp", fromApp);
      postData.append("stayTime", stayTime);
      postData.append("visitDepth", pageDeep);
      postData.append("token", localStorage.getItem("token"));
      if (navigator.sendBeacon) {
        postData.append("postMethods", "sendBeacon");
        navigator.sendBeacon(postUrl, postData);
      } else {
        postData.append("postMethods", "post");
        let client = new XMLHttpRequest();
        client.open("POST", postUrl, false); // 第三个参数表明是同步的 xhr
        client.setRequestHeader("Content-Type", "multipart/form-data");
        client.send(postData);
      }
    },
    closeBindPhone() {
      this.$store.commit("updateShowBindPhoneModal", {
        showBindPhoneModal: false
      });
    },
    finishBindMobile() {
      let recRelateId = this.$route.query.recRelateId || '';
      let recType = this.$route.query.recType || 0;
      if (recRelateId && recType == 2) {
        let data = { relateId: recRelateId }
        data.mobile = localStorage.getItem("uMobile");
        this.$nextTick(() => {
          this.$refs.recommendPresent.completetRecommendTask(data); // 调用子组件方法
        })
      }
      this.handleStorePerssion();
    },
    closeAddArea() {
      this.showAddAreaModal = false;
    }
  },
  destroyed() {},
};
</script>

<style lang="scss">
@import '~@/assets/css/appadmin.css';
@import '~@/assets/css/scss/platformTheme.scss';
[v-cloak] {
  display: none;
}
.fontAdjust {
  -ms-text-size-adjust: 100% !important;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
  -moz-text-size-adjust: 100% !important;
}
/* 默认 */
.theme-fc {
  color: #ff8831;
  color: var(--mb7color);
}
.theme-fc-hover:hover {
  color: #ff8831;
  color: var(--mb7color);
}
.theme-bg-6 {
  background: var(--rgba6color);
}
.theme-bg-10 {
  background: var(--rgba10color);
}
.theme-bg-20 {
  background: var(--rgba20color);
}
.theme-bg-80 {
  background-color: rgba(255, 99, 45, 0.8);
  background: var(--rgba80color);
}
.theme-bg {
  background-color: #ff8831;
  background-color: var(--mb7color);
}
.swiper-container .theme-bg {
  background-color: #ff8831;
  background-color: var(--mb7color) !important;
}
.theme-bg-50 {
  background: var(--rgba50color);
}
.theme-bg-gradient {
  background: linear-gradient(
    90deg,
    rgba(255, 99, 45, 1) 0%,
    rgba(255, 99, 45, 0.7) 100%
  );
  background: var(--rgbcolor);
}
.theme-bg-gradient180 {
  background: linear-gradient(
    180deg,
    rgba(255, 99, 45, 1) 0%,
    rgba(255, 99, 45, 0.7) 100%
  );
  background: var(--rgbcolor2);
}
.theme-bg-gradient18002 {
  background: linear-gradient(
    180deg,
    rgba(255, 99, 45, 1) 0%,
    rgba(255, 99, 45, 0.7) 100%
  );
  background: var(--rgbcolor3);
}
.theme-bg-gradient18000 {
  background: linear-gradient(
    180deg,
    rgba(255, 99, 45, 1) 0%,
    rgba(255, 99, 45, 0.7) 100%
  );
  background: var(--rgbcolor4);
}
.theme-bg-gradient18050{
  background: linear-gradient(
    180deg,
    rgba(255, 99, 45, 0.5) 0%,
    rgba(255, 99, 45, 0) 100%
  );
  background: var(--rgbacolor18050);
}

.theme-bg-gradient18020 {
  background: linear-gradient(
    180deg,
    rgba(255, 99, 45, 1) 0%,
    rgba(255, 99, 45, 0) 100%
  );
  background: var(--rgbcolor5);
}
.thme-bg-gradient1 {
  background: -webkit-linear-gradient(90deg, #F5F7FA, #ff8831);
  background: -webkit-linear-gradient(90deg, #F5F7FA, var(--mb7color));
}
.theme-bg-gradient2 {
  background: -webkit-linear-gradient(90deg, rgba(255, 99, 45, 0.5), #ff8831);
  background: -webkit-linear-gradient(90deg, var(--rgba50color), var(--mb7color));
}
.theme-bg:hover,
.theme-bg:focus {
  background-color: #ff8831;
  background-color: var(--mb7color);
}
.theme-bd1 {
  border: 1px solid #ff8831;
  border: 1px solid var(--mb7color);
}
.theme-bd-t1 {
  border-top: 1px solid #ff8831;
  border-top: 1px solid var(--mb7color);
}
.theme-bd1-20 {
  border: 1px solid rgba(255, 99, 45, 0.2);
  border: 1px solid var(--rgba20color);
}
.theme-bd1-50 {
  border: 1px solid rgba(255, 99, 45, 0.5);
  border: 1px solid var(--rgba50color);
}
.theme-bd2 {
  border: 2px solid #ff8831;
  border: 2px solid var(--mb7color);
}
.theme-bd4 {
  border: 0.1rem solid #ff8831;
  border: 0.1rem solid var(--mb7color);
}
.theme-bd-b2 {
  border-bottom: 2px solid #ff8831;
  border-bottom: 2px solid var(--mb7color);
}
.theme-bd-b1 {
  border-bottom: 1px solid #ff8831;
  border-bottom: 1px solid var(--mb7color);
}
.theme-bd-rd1 {
  border-right: 1px dashed #ff8831;
  border-right: 1px dashed var(--mb7color);
}
.theme-bd-r1 {
  border-right: 1px solid #ff8831;
  border-right: 1px solid var(--mb7color);
}
.theme-bd-l1 {
  border-left: 1px solid #ff8831;
  border-left: 1px solid var(--mb7color);
}
.theme-bd-l2 {
  border-left: 2px solid #ff8831;
  border-left: 2px solid var(--mb7color);
}
.theme-bd-l4 {
  border-left: 4px solid #ff8831;
  border-left: 4px solid var(--mb7color);
}
.theme-box-shadow {
  box-shadow: 0px 3px 10px 0px rgba(255, 99, 45, 0.2);
  box-shadow: var(--shadowcolor);
}
.theme-market .theme-bg-gradient {
  background-image: -webkit-linear-gradient(0, var(--marketColor2) 0%, var(--marketColor1) 100%);
}
.theme-market .theme-fc {
  color: var(--marketColor1);
}
.theme-market .theme-bd1 {
  border: 1px solid var(--marketColor1);
}
.theme-market .theme-bg {
  background: var(--marketColor1);
}
.theme-market .theme-bg-10 {
  background: var(--rgba10MarketColor);
}
.theme-market .theme-box-shadow  {
  box-shadow: 0 3px 10px 0 rgba(var(--marketColorRgb), 0.2); ;
}
.weui-mask {
  z-index: 4000 !important;
}
.weui-dialog {
  z-index: 10000 !important;
  max-width: 16rem;
}
.dialog-visible .weui-dialog {
  overflow: visible;
  border-radius: 0.5rem;
}
.weui-switch {
  width: 2rem !important;
  height: 1.2rem !important;
  border-radius: 0.6rem !important;
}
.weui-switch:before {
  width: 1.9rem !important;
  height: 1.1rem !important;
  border-radius: 0.55rem !important;
}

.weui-switch:after {
  width: 1.1rem !important;
  height: 1.1rem !important;
}
.weui-cell:before {
  border-top: 0 !important;
}
.orange-switch .weui-switch:checked,
.weui-switch-cp__input:checked ~ .weui-switch-cp__box {
  border-color: #ff7800;
  background-color: #ff7800;
}
.aplayer-music {
  max-width: 9rem !important;
}
.aplayer-title {
  font-size: 0.55rem !important;
  max-width: 100% !important;
  text-overflow: ellipsis !important;
}
.aplayer-bar-wrap {
  width: 5.079rem !important;
}
.vux-popup-dialog{
  z-index: 40002 !important;
}
.weui-toast {
  display: flex;
  display: -webkit-flex;
  flex-direction: column;
  -webkit-flex-direction: column;
  justify-content: center;
  -webkit-justify-content: center;
  align-items: center;
  -webkit-align-items: center;
  z-index: 99999 !important;
  top: 40% !important;
  width: 12.5rem!important;
  background: rgba(0, 0, 0, 0.5)!important;
  /* background: rgba(255, 255, 255, 0.95) !important; */
  box-shadow: 0px 4px 40px 0px rgba(0, 0, 0, 0.1) !important;
  border-radius: 10px !important;
  min-height: auto;
  padding: 1rem 0.5rem;
}
.weui-toast_text {
  padding: 0rem !important;
}
.weui-icon_toast {
  margin: 0 auto;
}
.weui-toast__content {
  margin: 10px auto 0 auto;
  /* color: #333; */
  color: #fff!important;
  padding: 0 10px;
}
.weui-icon_toast.weui-icon-success-no-circle:before {
  color: #45b930 !important;
  font-size: 1.3rem;
  content: '\EA06';
}
// 为了给toast的图标加白底
.weui-icon_toast.weui-icon-success-no-circle::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 1rem;
  height: 1rem;
  background-color: #fff;
  border-radius: 50%;
  z-index: -1;
}
.weui-toast_forbidden .weui-icon_toast.weui-icon-success-no-circle:before {
  color: #ff0000 !important;
  font-size: 1.3rem;
}
.vux-cell-box .weui-cell {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
/* 去掉popup的上方灰色 */
.vux-no-group-title {
  margin-top: 0 !important;
}
/* 关注弹窗蒙版 */
.vux-masker-fullscreen {
  position: fixed;
  z-index: 10001;
  background-color: rgba(0, 0, 0, 0.5);
  width: 100%;
  display: table;
}

.c-full-height > .vux-masker-fullscreen {
  height: 1999px;
}
.vux-popup-header {
  width: 100% !important;
  display: flex !important;
  display: -webkit-flex !important;
  flex-direction: row !important;
  -webkit-flex-direction: row !important;
  justify-content: space-between !important;
  -webkit-justify-content: space-between !important;
}

.vux-popup-header-left,
.vux-popup-header-right {
  padding-left: 0 !important;
  padding-right: 0 !important;
  width: 29% !important;
  text-align: center !important;
}
.vux-popup-header-title {
  width: 38%;
  -webkit-box-flex: 0 !important;
  -ms-flex: 0 !important;
  flex: 0 !important;
}
/* 去除vux ios多出小箭头样式 */
.weui-cell__ft {
  padding: 0 !important;
}
.weui-cell {
  padding: 0 !important;
}
.weui-cell__ft:after {
  display: none !important;
}
.reset-popup-picker .weui-cell_access .weui-cell__ft:after {
  height: 0 !important;
  width: 0 !important;
  border-width: 0 !important;
}
//datetime组件显示主题色
.datetime-theme-fc .vux-cell-value{
  color: var(--mb7color) !important;
}

#indexAd .weui-dialog {
  background-color: transparent !important;
}
.m6-bg {
  background: #f5f7fa;
}
.vcp-poster::after {
  content: "\e869";
  position: absolute;
  top: 50%;
  left: 50%;
  color: #fff;
  font-family: "iconfont" !important;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  font-size: 2rem;
  transform: translate(-50%, -50%);
}
.pdf-video-small {
  height: 8rem !important;
  width: 3rem !important;
}
.pdf-video-small .vjs-big-play-button {
  width: 1.8em !important;
  height: 1.5em !important;
  margin-left: -1em !important;
}
.pdf-video-small canvas {
  width: 0;
  height: 0;
}
/* 优惠券弹窗 */
.dialog-mid {
  background: url("../public/i/wap/coupon/dialog_mid.png") no-repeat;
  background-size: 100% 100%;
}
.coupon-left {
  background: url("../public/i/wap/coupon/coupon_left.png") no-repeat 100%;
  background-size: 100% 100%;
}
.exchange-left {
  background: url("../public/i/wap/coupon/exchange.png") no-repeat 100%;
  background-size: 100% 100%;
}
.button-bg {
  background-color: #ee6d3f;
}
.coupon-shadow {
  box-shadow: 0px 5px 10px 0px rgba(179, 30, 24, 0.12);
}
.dia-coupon-butt {
  background: url("../public/i/wap/coupon/button.png") no-repeat 100%;
  background-size: 100% 100%;
  color: #852f00;
  left: 50%;
  margin-left: -3.375rem;
  top: 0.8rem;
}
.dia-head-bg {
  padding-top: 3.4rem;
}
.c-mb56 {
  margin-bottom: 1.4rem;
}
.c-maxh440 {
  max-height: 11rem;
}
.c-fs44 {
  font-size: 1.1rem;
}
.c-spacing-3 {
  letter-spacing: 3px;
}
.c-hh114 {
  height: 2.85rem;
}
.c-lh120 {
  line-height: 3rem;
}
.c-p-t32 {
  top: 0.8rem;
}
/*西瓜播放器*/
.xgplayer-skin-default .xgplayer-cssfullscreen,
.xgplayer-skin-default .xgplayer-cssfullscreen-img {
  margin-right: 10px !important;
  margin-left: 10px;
}
.xgplayer-skin-default .xgplayer-playbackrate,
.xgplayer-skin-default .xgplayer-start {
  width: 50px !important;
}
.xgplayer-skin-default .xgplayer-rotate {
  margin: 0 10px !important;
}
.xgplayer-skin-default .xgplayer-start {
  height: 50px !important;
  background: rgba(0, 0, 0, 0.6) !important;
}
.xgplayer-skin-default .xgplayer-start div svg {
  width: 50px !important;
  height: 50px !important;
}
.xgplayer-skin-default .xgplayer-controls {
  margin: auto auto !important;
  width: 100% !important;
  height: 46px !important;
}
.xgplayer-loading {
  display: none !important;
}
.xgplayer-icon-play svg, .xgplayer-icon-pause svg, .xgplayer-icon-requestfull svg, .xgplayer-icon-exitfull svg, .xgplayer-rotate svg {
  width: 32px;
  height: 32px;
}
.xgplayer-icon-airplay svg {
  width: 24px;
  height: 24px;
}
.xgplayer-airplay {
  width: 28px !important;
  margin-left: 2px !important;
}
.xgplayer-play .xgplayer-icon, .xgplayer-rotate .xgplayer-icon, .xgplayer-airplay .xgplayer-icon, .xgplayer-skin-default .xgplayer-cssfullscreen .xgplayer-icon {
  margin-top: 9px !important;
}
.xgplayer-skin-default .xgplayer-rotate .xgplayer-icon {
  margin-left: 10px;
}
.xgplayer-skin-default .xgplayer-rotate {
  margin: 0 0 0 10px !important
}
.xgplayer-skin-default .xgplayer-playbackrate {
  margin-top: -117px !important;
}
.xgplayer-skin-default .xgplayer-playbackrate ul {
  border-radius: 8px !important;
  left: 60% !important;
}
.xgplayer-skin-default .xgplayer-playbackrate ul li {
  opacity: 1 !important;;
  color: #ccc !important;
  font-size: 12px !important;
  padding: 3px 0 !important;
}
.xgplayer-skin-default .xgplayer-playbackrate ul li.selected, .xgplayer-skin-default .xgplayer-playbackrate ul li:hover {
  color: #fff !important;
}
.xgplayer-skin-default .xgplayer-playbackrate ul li:first-child {
  margin-top: 8px !important;
}
.xgplayer-skin-default .xgplayer-playbackrate ul li:last-child {
  margin-bottom: 8px !important;
}
.xgplayer-skin-default.xgplayer-is-cssfullscreen {
  border-radius: 0;
}
/* 腾讯播放器样式重置 */
.tcCssFullScreen {
  position: fixed!important;
  left: 0!important;
  top: 0!important;
  width: 100%!important;
  height: 100%!important;
  z-index: 9999!important;
  border-radius: 0!important;
}
.css-full-icon {
  cursor: pointer;
  -webkit-box-flex: none;
  -moz-box-flex: none;
  -webkit-flex: none;
  -ms-flex: none;
  flex: none;
}
.css-full-icon .full-icon {
  font-weight: 400;
  font-style: normal;
}
.vcp-playtoggle{
  background-image:url('') !important;;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  transform: scale(0.4) !important;
}
.vcp-playing .vcp-playtoggle{
  background-image:url('') !important;;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  transform: scale(0.4) !important;
}
.vcp-fullscreen-toggle{
  background-image:url('') !important;;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  transform: scale(0.4) !important;
}
.vcp-fullscreen .vcp-fullscreen-toggle{
  background-image:url('') !important;;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  transform: scale(0.4) !important;
}
.vcp-timeline{
  height: 2px !important;
  top: 0 !important;
}
.vcp-timeline .vcp-slider {
  margin-top:0 !important;
}
.vcp-timeline:hover .vcp-slider{
  height: 2px !important;
  margin-top:0 !important;
}
.vcp-timeline:hover .vcp-slider-thumb{
  top: -7px !important;
}
.vcp-slider .vcp-slider-thumb::after{
  content: ' ';
  width: 20px;
  height: 20px;
  position: absolute;
  left: -5px;
  top: -6px;
}
</style>